<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      ul {
        list-style: none;
        float: left;
        margin-right: 50px;
      }
      li {
        width: 100px;
        height: 100px;
        text-align: center;
        line-height: 100px;
        border: 1px solid #ccc;
      }
      li.current {
        background-color: blue;
      }
      div {
        width: 300px;
        height: 200px;
        float: left;
        text-align: center;
        line-height: 200px;
        border: 1px solid red;
        display: none;
        float: left;
      }
      div.current {
        background-color: blue;
        display: block;
      }

      p {
        width: 57px;
        height: 17px;
        background: #fd7115;
        border-radius: 1px;
        opacity: 0.1;
        position: absolute;
        left: 0;
        top: 0;
      }
      span {
        height: 13px;
        font-size: 10px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #fd7115;
        line-height: 13px;
      }
    </style>
  </head>
  <body>
    <ul>
      <li class="current">1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
    </ul>
    <div class="current">1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>

    <p>
      
    </p>
    <span>一图游中国</span>

    <script>
      var list = document.getElementsByTagName("li");
      var dvObjs = document.getElementsByTagName("div");

      for (var i = 0; i < list.length; i++) {
        list[i].setAttribute("index", i);
        list[i].onclick = function () {
          for (var j = 0; j < list.length; j++) {
            list[j].removeAttribute("class");
          }
          this.className = "current";

          for (var k = 0; k < dvObjs.length; k++) {
            dvObjs[k].removeAttribute("class");
          }
          var index = this.getAttribute("index");
          dvObjs[index].className = "current";
        };
      }
    </script>
  </body>
</html>
